<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- <script src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script> -->
</head>

<body>
  <div class="missyt" name="hello-missyt" aria-readonly="true"></div>
  <div class="oo"></div>
  <script type="module">
    // require(['../dist/index.umd.js'], function (x) {
    //   console.log(x)
    // })
    import { Pubsub, deepClone, formatDate, diffDays, getRandomString, getRandomInt, getImageSizeByUrl, downloadImage } from '../dist/index.esm.js'

    Pubsub.subscribe('login', data => {
      console.log('subscribe 1', data);
    })

    Pubsub.subscribe('login', data => {
      console.log('subscribe 2', data);
    })

    Pubsub.subscribe('refresh', data => {
      console.log('refresh 1', data);
    })
    Pubsub.unscribe('refresh');
    Pubsub.unscribe('token_1329');

    console.log(formatDate('2019-12-29 23:35:17', 'dd-MM-yy hh:mm'))

    console.log(diffDays(new Date('2022-10-25 13:34:10'), new Date('2022-10-30 13:34:10')));

    console.log(getRandomString(8));

    console.log(getImageSizeByUrl('https://sponsors.vuejs.org/images/xitujuejinjishushequ.avif').then(res => console.log(res)))

    downloadImage('https://sponsors.vuejs.org/images/xitujuejinjishushequ.avif', 'vue.avif');

    let person = { name: 'hello', hobby: { name: '篮球', time: 3 } };
    let _copy = deepClone(person);
    person.hobby.name = '羽毛球';
    console.log(_copy); //{ name: 'hello', hobby: { name: '篮球', time: 3 } }

  </script>

</body>

</html>